<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="copyright" content="Tencent"/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
	<title>參加活动成功</title>
    <link href="<%=path%>/favicon.ico" rel="shortcut icon">
    <link href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/marketing/public.css" />
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/marketing/marketing.css" />
	<style>
    	.s_bg{
			background:url(<%=path%>/images/marketing/activity_success_bg.png) no-repeat;
			background-size:100% 100%;
		}
    </style>
</head>
<body class="s_activity_body" style="background:#fff">
    <div class="k_phone" id="qy_card" style="height:100%;">
        <div class="s_bg" style="padding:30px 20px 20px 20px">
            <p id="successHintPreview" class="text-center" style="color:white;font-size:16px;">恭喜您成功参与本次活动</p>
            <div id="successExplainPreview" style="padding:20px;color:white;font-size:14px;">请持续关注我们的活动，更多惊喜等你来！</div>
            <div style="text-align:center">
               <button id="btnShowCouponList" class="btnShowCoupon btn btn-w-m btn-white" style="background-color:#ffffff">点击查看券列表</button>
            </div>
            
        </div>
        
        <div id="qrcodePreview" class="col-md-12 text-center" align="center" style="text-align:center;position: absolute;bottom: 0;width:100%" hidden="">
                <h6 id="qrcodeHintPreview">长按识别二维码</h6>
                <img  class="qrcodeImg" style="width:80px;height:80px;margin-top:5px" src="<%=path%>/images/marketing/icon_wb.png">
                <p class="k_footer">zhfeat提供技术服务</p>
        </div>
        
    </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/marketing/qrcode.js"></script>
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="<%=path%>/js/marketing/public.js"></script>

<script type="text/javascript">

var previewId = "";
$(function(){
	previewId = getQueryString("previewId"); 
	getDetail();
});

//获取详情
function getDetail(){
	var url = "<%=path%>/material/ajaxGetMaterialSuccessPagePreview";
	$.post(url, {
		"previewId" : previewId,
	}, function(data) {
		console.log(data);
		if (data.status == 200) {
			initHtml(data.data);
		} else {
			$('#qrcodeImg').hide();
		}
	});
}
//初始化页面
function initHtml(data){
	 var successTip=data.title;
	 var successDescription=data.tipText;
	 var listButtonText=data.buttonCouponText;
	 var isShowQrcode=data.isShowQrcode;
	 var isShowCouponBtn = data.isShowCouponBtn;
	 var qrcodeTip=data.qrcodeText;
	 var bgPic=data.backPic;
	 var qrcodePic=data.qrcodePic;
	 var tipHeight=data.tipHeight;
	 var buttonCouponColor=data.buttonCouponColor;
	 var buttonCouponTextColor = data.buttonCouponTextColor;
	 if(StringEmpty(successTip)){
		 $('#successHintPreview').html(successTip);
	 }
	 if(StringEmpty(successDescription)){
		 $('#successExplainPreview').html(successDescription);
	 }
	 if(isShowCouponBtn == 0){
	     $('#btnShowCouponList').hide();
     }
	 if(StringEmpty(listButtonText)){
		 $('#btnShowCouponList').html(listButtonText);
	 }
	 
	 if(buttonCouponTextColor!='#000000'){
    	 $("#btnShowCouponList").css("color",buttonCouponTextColor);
     }
	 
	 $('#qrcodeHint').val(qrcodeTip);
	 $('#qrcodeHintPreview').html(qrcodeTip);
	 
	 if(StringEmpty(buttonCouponColor)&& buttonCouponColor != '#000000'){
		 $('.btnShowCoupon').css("background-color",buttonCouponColor);
	 }
	 if(StringEmpty(bgPic)){
		 $(".s_bg").css("background-image", "url(" + bgPic + ")");
	 }
	 if(StringEmpty(tipHeight)){
		 $(".s_bg").css("height", tipHeight);
	 }
	 if(StringEmpty(qrcodePic)){
		 $('.qrcodeImg').attr("src",qrcodePic);
	 }
	 if(isShowQrcode){
		 $('#qrcodePreview').show();
	 }else{
		 $('#qrcodePreview').hide();
	 }
	 
}  

    
    

</script>
</body>
</html>
